var prefix = ctx + "admin/log";

$(function() {
	var options = {
		url : prefix + "/page",
		cleanUrl : prefix + "/clean",
		detailUrl : prefix + "/detail/{id}",
		removeUrl : prefix + "/{id}",
		exportUrl : prefix + "/export",
		sortName : "createTime",
		sortOrder : "desc",
		modalName : "操作日志",
		escape : true,
		showPageGo : true,
		rememberSelected : true,
		columns : [{
		            title: "序号",
		            formatter: function (value, row, index) {
		         	    return $.table.serialNumber(index);
		            }
		        },
				{
					field : 'type',
					title : '日志类型',
					align : 'center',
					formatter : function(value, row, index) {
						// return $.table.selectDictLabel(datas, value);
						if (value == 0) {
							return '<span class="badge badge-primary">成功</span>';
						} else if (value == 9) {
							return '<span class="badge badge-danger">失败</span>';
						}
					}
				},
				{
					field : 'title',
					title : '日志标题'
				},

				{
					field : 'createBy',
					title : '操作人员'
				},
				{
					field : 'remoteAddr',
					title : '操作Ip地址'
				},
				{
					field : 'method',
					title : '操作方式'
				},
				{
					field : 'createTime',
					sortable: true,
					title : '创建时间'
				},
				{
					title : '操作',
					align : 'center',
					formatter : function(value, row, index) {
						var actions = [];
		                actions.push('<a class="btn btn-danger btn-xs ' + deleteFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
		                actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详细</a>');
		                return actions.join('');
					}
				} ]
	};
	$.table.init(options);
});